package pool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created with IntelliJ IDEA.
 * Description:线程池
 * User: bjc
 * Date: 2025-09-18
 * Time: 11:07
 */
public class Test1 {
    public static void main(String[] args) {
        ExecutorService service = Executors.newFixedThreadPool(4);
        //使用线程池执行任务
        for (int i = 0; i < 10; i++) {
            service.submit(new Runnable() {
                @Override
                public void run() {
                    System.out.println(Thread.currentThread().getName());
                }
            });
        }

    }
}
